

import http from "../commons/utils/axios-util";
import Environments from "../commons/utils/env-util";
import HttpUtil from "../commons/utils/http-util";

/**
 * 文件上传
 */
export default class FileUploadApi {
    public static REQUEST_PREFIX = 'fileUpload/';
    public static APP_WEB_SUFFIX = Environments.getEvnProp("VITE_APP_WEB_SUFFIX");

    /**
     * 上传图片
     * @param busniessId 
     */
    static uploadImg(busniessId: string, params: any) {
        return http.post(`${FileUploadApi.REQUEST_PREFIX}uploadImg${FileUploadApi.APP_WEB_SUFFIX}?busniessId=${busniessId}`,
            params)
    }

    /**
     * 上传文件
     * @param busniessId 
     */
    static uploadFile(busniessId: string, params: any) {
        return http.post(`${FileUploadApi.REQUEST_PREFIX}uploadFile${FileUploadApi.APP_WEB_SUFFIX}?busniessId=${busniessId}`, params);
    }


    /**
     * 预览图片
     * @param busniessId 
     */
    static previewImg(busniessId: string) {
        return HttpUtil.stringUrl(`${FileUploadApi.REQUEST_PREFIX}previewImg`,{
            busniessId
        });
    }


    /**
     * 下载文件
     * @param busniessId 
     */
    static downloadFile(busniessId: string) {
        return HttpUtil.stringUrl(`${FileUploadApi.REQUEST_PREFIX}downloadFile`,{
            busniessId
        });
    }



}
